<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCouponsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupons', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->comment('优惠标题');
            $table->string('code')->comment('优惠码');
            $table->tinyInteger('type')->comment('优惠类型');
            $table->decimal('price')->comment('优惠价格');
            $table->integer('total')->comment('总个数');
            $table->integer('used')->comment('已使用个数');
            $table->integer('min_amount')->comment('最低使用价格');
            $table->date('not_before')->comment('优惠使用最早时间');
            $table->date('not_after')->comment('优惠使用最后时间');
            $table->tinyInteger('enabled')->comment('是否启用');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupons');
    }
}
